package com.hiultra.archive.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hiultra.common.annotation.Log;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import com.hiultra.common.enums.BusinessType;
import com.hiultra.archive.domain.ArchiveUploadTaskArchive;
import com.hiultra.archive.service.IArchiveUploadTaskArchiveService;
import com.hiultra.common.utils.poi.ExcelUtil;
import com.hiultra.common.core.page.TableDataInfo;

/**
 * 转存档案Controller
 * 
 * @author paidaxing
 * @date 2024-07-24
 */
@RestController
@RequestMapping("/archive/ArchiveUploadTaskArchive")
public class ArchiveUploadTaskArchiveController extends BaseController
{
    @Autowired
    private IArchiveUploadTaskArchiveService archiveUploadTaskArchiveService;

    /**
     * 查询转存档案列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:list')")
    @GetMapping("/list")
    public TableDataInfo list(ArchiveUploadTaskArchive archiveUploadTaskArchive)
    {
        startPage();
        List<ArchiveUploadTaskArchive> list = archiveUploadTaskArchiveService.selectArchiveUploadTaskArchiveList(archiveUploadTaskArchive);
        return getDataTable(list);
    }

    /**
     * 导出转存档案列表
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:export')")
    @Log(title = "转存档案", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ArchiveUploadTaskArchive archiveUploadTaskArchive)
    {
        List<ArchiveUploadTaskArchive> list = archiveUploadTaskArchiveService.selectArchiveUploadTaskArchiveList(archiveUploadTaskArchive);
        ExcelUtil<ArchiveUploadTaskArchive> util = new ExcelUtil<ArchiveUploadTaskArchive>(ArchiveUploadTaskArchive.class);
        util.exportExcel(response, list, "转存档案数据");
    }

    /**
     * 获取转存档案详细信息
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(archiveUploadTaskArchiveService.selectArchiveUploadTaskArchiveById(id));
    }

    /**
     * 新增转存档案
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:add')")
    @Log(title = "转存档案", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ArchiveUploadTaskArchive archiveUploadTaskArchive)
    {
        return toAjax(archiveUploadTaskArchiveService.insertArchiveUploadTaskArchive(archiveUploadTaskArchive));
    }

    /**
     * 修改转存档案
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:edit')")
    @Log(title = "转存档案", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ArchiveUploadTaskArchive archiveUploadTaskArchive)
    {
        return toAjax(archiveUploadTaskArchiveService.updateArchiveUploadTaskArchive(archiveUploadTaskArchive));
    }

    /**
     * 删除转存档案
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:remove')")
    @Log(title = "转存档案", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(archiveUploadTaskArchiveService.deleteArchiveUploadTaskArchiveByIds(ids));
    }

    /**
     * 修改转入转出状态
     */
    @PreAuthorize("@ss.hasPermi('archive:ArchiveUploadTaskArchive:updateAArchiveUploadTaskArchiveStatus')")
    @Log(title = "修改转入转出状态", businessType = BusinessType.UPDATE)
    @PostMapping("/updateArchiveUploadTaskArchiveStatus")
    public AjaxResult updateArchiveUploadTaskArchiveStatus(@RequestParam("ids") String[] ids, @RequestParam("status")String status) {
        return toAjax(archiveUploadTaskArchiveService.updateArchiveUploadTaskArchiveStatus(ids, status));
    }
}
